<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta
            http-equiv="Content-Type"
            content="text/html; charset=utf-8"
        />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <title>Python Slack SDK &mdash; Python Slack SDK</title>

        <!-- Google Tag Manager -->
        <script>
            (function(w, d, s, l, i) {
                w[l] = w[l] || [];
                w[l].push({
                    'gtm.start': new Date().getTime(),
                    event: 'gtm.js'
                });
                var f = d.getElementsByTagName(s)[0],
                    j = d.createElement(s),
                    dl = l != 'dataLayer' ? '&l=' + l : '';
                j.async = true;
                j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
                f.parentNode.insertBefore(j, f);
            })(window, document, 'script', 'dataLayer', 'GTM-KFZ5MK7');
        </script>
        <!-- End Google Tag Manager -->
        
        <link
            href="https://a.slack-edge.com/4f227/style/rollup-slack_kit_legacy_adapters.css"
            rel="stylesheet"
            type="text/css"
        />
        <link
            href="https://a.slack-edge.com/3e02c0/style/rollup-api_site.css"
            rel="stylesheet"
            type="text/css"
        />
        <link
            rel="stylesheet"
            href="./assets/default.css"
            type="text/css"
        />
        <link
            rel="stylesheet"
            href="./assets/pygments.css"
            type="text/css"
        />
        <link
            rel="stylesheet"
            href="./assets/docs.css"
            type="text/css"
        />
        <link
            id="favicon"
            rel="shortcut icon"
            href="https://a.slack-edge.com/4f28/img/icons/favicon-32.png"
            type="image/png"
        />
        <link
            rel="top"
            title="Python Slack SDK 1.0.1 documentation"
            href="#"
        />
    </head>

    <body class="api light_theme">
        <!-- Google Tag Manager (noscript) -->
        <noscript
            ><iframe
                src="https://www.googletagmanager.com/ns.html?id=GTM-KFZ5MK7"
                height="0"
                width="0"
                style="display:none;visibility:hidden"
            ></iframe
        ></noscript>
        <!-- End Google Tag Manager (noscript) -->
        <header>
            <a id="menu_toggle" class="no_transition show_on_mobile">
                <span class="menu_icon"></span>
                <span class="vert_divider"></span>
            </a>
            <a
                href="https://api.slack.com/"
                id="header_logo"
                class="api hide_on_mobile"
                style="float:left; display: inline-block;"
            >
                <img
                    alt="Slack API"
                    src="https://a.slack-edge.com/3026cb/img/slack_api_logo_vogue.png"
                    style="width: 225px; padding-right: 25px; border-right: 1px solid #DDD;"
                />
            </a>
            <span
                style="display: inline-block; padding-left: 20px; margin-top: 25px; font-weight: bold;"
            >
                <a style="color: #555459;" href="./index.html">Python Slack SDK</a>
            </span>
            <div class="header_nav">
                <a
                    href="https://github.com/SlackAPI/python-slack-sdk"
                    class="btn header_btn float_right"
                    data-qa="go_to_slack"
                    >Go to GitHub</a
                >
            </div>
        </header>
        

        <div id="page">
            <div id="page_contents" class="clearfix">
                <!-- Sidebar Content -->
                <nav id="api_nav" class="col span_1_of_4">
                    <div id="api_sections">
                         <ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Python Slack SDK</a></li>
<li class="toctree-l1"><a class="reference internal" href="v3-migration/index.html">Migration Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="v3-migration/index.html#from-slackclient-2-x">From slackclient 2.x</a></li>
<li class="toctree-l2"><a class="reference internal" href="v3-migration/index.html#from-slackclient-1-x">From slackclient 1.x</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="installation/index.html">Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="installation/index.html#access-tokens">Access Tokens</a></li>
<li class="toctree-l2"><a class="reference internal" href="installation/index.html#workspace-installations">Workspace Installations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="web/index.html">Web Client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="web/index.html#messaging">Messaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="web/index.html#files">Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="web/index.html#conversations">Conversations</a></li>
<li class="toctree-l2"><a class="reference internal" href="web/index.html#modals">Modals</a></li>
<li class="toctree-l2"><a class="reference internal" href="web/index.html#rate-limits">Rate Limits</a><ul>
<li class="toctree-l3"><a class="reference internal" href="web/index.html#calling-any-api-methods">Calling any API methods</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="web/index.html#asyncwebclient">AsyncWebClient</a></li>
<li class="toctree-l2"><a class="reference internal" href="web/index.html#retryhandler">RetryHandler</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="webhook/index.html">Webhook Client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="webhook/index.html#id1">Incoming Webhooks</a></li>
<li class="toctree-l2"><a class="reference internal" href="webhook/index.html#response-url">response_url</a></li>
<li class="toctree-l2"><a class="reference internal" href="webhook/index.html#asyncwebhookclient">AsyncWebhookClient</a></li>
<li class="toctree-l2"><a class="reference internal" href="webhook/index.html#retryhandler">RetryHandler</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="socket-mode/index.html">Socket Mode Client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="socket-mode/index.html#socketmodeclient">SocketModeClient</a></li>
<li class="toctree-l2"><a class="reference internal" href="socket-mode/index.html#supported-libraries">Supported Libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="socket-mode/index.html#asyncio-based-libraries">Asyncio Based Libraries</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="oauth/index.html">OAuth Modules</a><ul>
<li class="toctree-l2"><a class="reference internal" href="oauth/index.html#app-installation-flow">App Installation Flow</a></li>
<li class="toctree-l2"><a class="reference internal" href="oauth/index.html#token-lookup">Token Lookup</a></li>
<li class="toctree-l2"><a class="reference internal" href="oauth/index.html#sign-in-with-slack">Sign in with Slack</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="audit-logs/index.html">Audit Logs API Client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="audit-logs/index.html#auditlogsclient">AuditLogsClient</a></li>
<li class="toctree-l2"><a class="reference internal" href="audit-logs/index.html#asyncauditlogsclient">AsyncAuditLogsClient</a></li>
<li class="toctree-l2"><a class="reference internal" href="audit-logs/index.html#retryhandler">RetryHandler</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="scim/index.html">SCIM API Client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="scim/index.html#scimclient">SCIMClient</a></li>
<li class="toctree-l2"><a class="reference internal" href="scim/index.html#asyncscimclient">AsyncSCIMClient</a></li>
<li class="toctree-l2"><a class="reference internal" href="scim/index.html#retryhandler">RetryHandler</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="real_time_messaging.html">RTM Client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="real_time_messaging.html#real-time-messaging-rtm">Real Time Messaging (RTM)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a><ul>
<li class="toctree-l2"><a class="reference internal" href="faq.html#python-documents">Python Documents</a></li>
<li class="toctree-l2"><a class="reference internal" href="faq.html#installation-issues">Installation Issues</a></li>
<li class="toctree-l2"><a class="reference internal" href="faq.html#bug-report">Bug Report</a></li>
<li class="toctree-l2"><a class="reference internal" href="faq.html#feature-requests">Feature Requests</a></li>
<li class="toctree-l2"><a class="reference internal" href="faq.html#contributions">Contributions</a></li>
<li class="toctree-l2"><a class="reference internal" href="faq.html#documentation">Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="about.html">About</a><ul>
<li class="toctree-l2"><a class="reference internal" href="about.html#product-name">Python Slack SDK</a></li>
</ul>
</li>
</ul>


<div id="footer">

        <ul id="footer_nav">
                <li><a href="https://github.com/SlackAPI/python-slack-sdk/blob/main/LICENSE">License</a></li>
                <li><a href="https://slackhq.github.io/code-of-conduct">Code of Conduct</a></li>
                <li><a href="https://github.com/slackapi/python-slack-sdk/blob/main/.github/contributing.md">Contributing</a></li>
                <li><a href="https://docs.google.com/a/slack-corp.com/forms/d/e/1FAIpQLSfzjVoCM7ohBnjWf7eDYQxzti1EPpinsIJQA5RAUBwJKRUQHg/viewform">Contributor License Agreement</a></li>
        </ul>

        <p id="footer_signature">Made with <i class="ts_icon ts_icon_heart"></i> by Slack<br/>and our Lovely
                Community
        </p>
</div> 
                    </div>
                </nav>
                <!-- /Sidebar Content -->

                <!-- Body Content -->
                <div class="col span_3_of_4">
                    <!-- <div class="section-title">Python Slack SDK</div> -->
                    <div class="card">
  <div class="toctree-wrapper compound">
</div>
<section id="product-name">
<h1>Python Slack SDK<a class="headerlink" href="#product-name" title="Link to this heading">¶</a></h1>
<p>The Slack platform offers several APIs to build apps. Each Slack API delivers part of the capabilities from the platform, so that you can pick just those that fit for your needs. This SDK offers a corresponding package for each of Slack’s APIs. They are small and powerful when used independently, and work seamlessly when used together, too.</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Feature</p></td>
<td><p>What its for</p></td>
<td><p>Package</p></td>
</tr>
<tr class="row-even"><td><p>Web API</p></td>
<td><p>Send data to or query data from Slack using any of over 200 methods.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.web</span></code>
<code class="docutils literal notranslate"><span class="pre">slack_sdk.web.async_client</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Webhooks / response_url</p></td>
<td><p>Send a message using Incoming Webhooks or response_url</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.webhook</span></code>
<code class="docutils literal notranslate"><span class="pre">slack_sdk.webhook.async_client</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Socket Mode</p></td>
<td><p>Receive and send messages over Socket Mode connections.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.socket_mode</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>OAuth</p></td>
<td><p>Setup the authentication flow using V2 OAuth, OpenID Connect for Slack apps.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.oauth</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Audit Logs API</p></td>
<td><p>Receive audit logs API data.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.audit_logs</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>SCIM API</p></td>
<td><p>Utilize the SCIM APIs for provisioning and managing user accounts and groups.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.scim</span></code></p></td>
</tr>
<tr class="row-even"><td><p>RTM API</p></td>
<td><p>Listen for incoming messages and a limited set of events happening in Slack, using WebSocket.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.rtm_v2</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Request Signature Verification</p></td>
<td><p>Verify incoming requests from the Slack API servers.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.signature</span></code></p></td>
</tr>
<tr class="row-even"><td><p>UI Builders</p></td>
<td><p>Construct UI components using easy-to-use builders.</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">slack_sdk.models</span></code></p></td>
</tr>
</tbody>
</table>
<p>The Python module documents are available at <a class="reference external" href="https://slack.dev/python-slack-sdk/api-docs/slack_sdk/">https://slack.dev/python-slack-sdk/api-docs/slack_sdk/</a></p>
<section id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Link to this heading">¶</a></h2>
<p>This package supports Python 3.6 and higher. We recommend using <a class="reference external" href="https://pypi.python.org/pypi">PyPI</a> to install Python Slack SDK</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>slack_sdk
</pre></div>
</div>
<p>Of course, you can always pull the source code directly into your project:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/slackapi/python-slack-sdk.git
<span class="nb">cd</span><span class="w"> </span>python-slack-sdk
python3<span class="w"> </span>-m<span class="w"> </span>venv<span class="w"> </span>.venv
<span class="nb">source</span><span class="w"> </span>.venv/bin/activate
pip<span class="w"> </span>install<span class="w"> </span>-U<span class="w"> </span>pip
pip<span class="w"> </span>install<span class="w"> </span>-e<span class="w"> </span>.<span class="w">  </span><span class="c1"># install the SDK project into the virtual env</span>
</pre></div>
</div>
<p>And then, save a few lines of code as <code class="docutils literal notranslate"><span class="pre">./test.py</span></code>.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># test.py</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="c1"># Enable debug logging</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">logging</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">)</span>
<span class="c1"># Verify it works</span>
<span class="kn">from</span> <span class="nn">slack_sdk</span> <span class="kn">import</span> <span class="n">WebClient</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">WebClient</span><span class="p">()</span>
<span class="n">api_response</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_test</span><span class="p">()</span>
</pre></div>
</div>
<p>You can run the code this way.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>test.py
</pre></div>
</div>
<p>It’s also good to try on the Python REPL.</p>
</section>
<section id="getting-help">
<h2>Getting Help<a class="headerlink" href="#getting-help" title="Link to this heading">¶</a></h2>
<p>If you get stuck, we’re here to help. The following are the best ways to get assistance working through your issue:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/slackapi/python-slack-sdk/issues">GitHub Issue Tracker</a> for questions, feature requests, bug reports and general discussion related to this package.</p></li>
<li><p>Visit the <a class="reference external" href="http://slackcommunity.com">Slack Developer Community</a> for getting help using Python Slack SDK or just generally bond with your fellow Slack developers.</p></li>
</ul>
</section>
</section>


                        <div class="clear_both large_bottom_margin"></div>
                    </div>
                </div>
                <!-- /Body Content -->
            </div>
        </div>

        <footer>
            <p class="light tiny align_center">
                © 2015- Slack Technologies, LLC and contributors
            </p>
        </footer>

        <script>
            window.ga =
                window.ga ||
                function() {
                    (ga.q = ga.q || []).push(arguments);
                };
            ga.l = +new Date();
            ga('create', 'UA-56978219-13', 'auto');
            ga('send', 'pageview');
        </script>
        <script async src="https://www.google-analytics.com/analytics.js"></script>
    </body>
</html>